<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function ajax(url) {
            return new Promise((resolve, reject) => {
                const xhr = new XMLHttpRequest();
                xhr.open('GET', url, true);
                xhr.onreadystatechange = function () {
                    if (xhr.readyState === 4) {
                        if (xhr.status >= 200 && xhr.status < 300) {
                            let res = JSON.parse(xhr.responseText);
                            resolve(res);
                        } else {
                            reject(xhr.responseText);
                        }
                    }
                };
                xhr.send();
            });
        }

        ajax('./01.json')
           .then((res) => {
                console.log(res);
                return ajax('./02.json');
            })
           .then((res) => {
                console.log(res);
            })
           .catch((err) => {
                console.log(err);
            });
    </script>
</body>

</html>